package com.example.demo.config;

import com.example.demo.client.TestClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestClient;
import org.springframework.web.client.support.RestClientAdapter;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;

/**
 * 2025/9/30
 */
@Configuration
public class HttpClientConfig {

    @Bean
    public TestClient testClient(){;
        return HttpServiceProxyFactory
                .builderFor(RestClientAdapter.create(RestClient.builder()
                                        .baseUrl("http://localhost:8080").build())
                )
                .build().createClient(TestClient.class);
    }
}
